package com.cote.douhahou.pretloan.launcher;

import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.cote.douhahou.pretloan.R;
import com.cote.douhahou.pretloan.beans.PermissAkomapalendionInfo;

public class PermissionAkomapalendItemManager {

    private final View mVi_akomapalendew;

    private final ImageView permis_akomapalendsionIv;
    private final TextView per_akomapalendmissionTv;

    private final PermissAkomapalendionInfo permissionInfo;

    private boolean isSelect = false;

    private static final int Gray = Color.parseColor("#A0FFFFFF");

    public PermissionAkomapalendItemManager(View view, PermissAkomapalendionInfo permissionInfo){

        mVi_akomapalendew = view;

        permis_akomapalendsionIv = view.findViewById(R.id.ippa_iv_permission_img);
        per_akomapalendmissionTv = view.findViewById(R.id.ippa_tv_permission_title);

        this.permissionInfo = permissionInfo;

        permis_akomapalendsionIv.setBackgroundResource(permissionInfo.getI_akomapalendconResId_G_akomapalendray());
        per_akomapalendmissionTv.setText(permissionInfo.getT_akomapalenditle());

    }

    public void setS_akomapalendelect(boolean sel_akomapalendect) {
        isSelect = sel_akomapalendect;
        if (isSelect){
            permis_akomapalendsionIv.setBackgroundResource(permissionInfo.get_akomapalendIcon_akomapalendResId_White());
            per_akomapalendmissionTv.setTextColor(Color.WHITE);
        }else {
            permis_akomapalendsionIv.setBackgroundResource(permissionInfo.getI_akomapalendconResId_G_akomapalendray());
            per_akomapalendmissionTv.setTextColor(Gray);
        }
    }

    public void setItemWi_akomapalenddth(int width){
        ViewGroup.LayoutParams layoutParams = mVi_akomapalendew.getLayoutParams();
        layoutParams.width = width;
        mVi_akomapalendew.setLayoutParams(layoutParams);
    }

}
